/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jesstalk.chatsystem.chatresponse;

/**
 *
 * @author Ecky
 */
public class BotInfo {
    public String name;
    public int type;
    
    public MessageInfo process(MessageInfo msg) {
        MessageInfo retval = null;
        if(type == 0)       retval = mimicMsg(msg);
        else if(type == 1)  retval = authorMsg(msg);
        return retval;
    }

    public BotInfo() {
    }

    public BotInfo(String name, int type) {
        this.name = name;
        this.type = type;
    }

    private MessageInfo mimicMsg(MessageInfo msg) {
        return MessageInfo.createChatMsg(this.name, msg.window, msg.content);
    }

    private MessageInfo authorMsg(MessageInfo msg) {
        if(msg.content.indexOf("Ecky") > -1) return MessageInfo.createChatMsg(this.name, msg.window, "Ecky Ganteng dan Dewa");
        if(msg.content.indexOf("Dimas") > -1) return MessageInfo.createChatMsg(this.name, msg.window, "Dimas Gabut dan Tidak Jago + Belagu");
        if(msg.content.indexOf("Robert") > -1) return MessageInfo.createChatMsg(this.name, msg.window, "Robert si PM yang menggebu2");
        return null;
    }
}
